<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p onclick="alert('hi')" id="demo">点我</p>
    <script>
        let pElement = document.getElementById('demo')
        pElement.addEventListener('click', go)
        pElement.onclick = function () {
            pElement.innerHTML = "这是由js添加的内容"
        }
        function go() {
            console.log("这是由事件监听器添加的事件。")
        }


    </script>
</body>

</html>
